/* eslint-disable no-undef */
import Vue from 'vue'
import Vuex from 'vuex'
// 导入组件
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
import router from './modules/router'
// 导入让vuex数据持久化插件
import createPersisitedStatel from 'vuex-persistedstate'
Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    tagsView,
    permission,
    router
  },
  getters,
  plugins: [
    // 使用让 vuex 数据持久化的插件，传入配置
    createPersisitedStatel({
      // 本地存储键名 -> localstorage.setItem('hrsass-23'，vuex下的state数据)key:"hrsass-23
      key: '小说绘后台管理系统',
      paths: ['app', 'user', 'settings', 'permission']
    })
  ]
})

export default store
